package com.huang.lesson01;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class TestInetAddress {
    public static void main(String[] args) {
        try {
            InetAddress byAddress = InetAddress.getByName("127.0.0.1");
            System.out.println(byAddress);

            InetAddress byAddress2 = InetAddress.getByName("localhost");
            System.out.println(byAddress2);

            InetAddress byAddress3 = InetAddress.getLocalHost();
            System.out.println(byAddress3);

            //查询网站ip地址
            InetAddress byAddress4 = InetAddress.getByName("www.baidu.com");
            System.out.println(byAddress4);
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }
}
